package org.se.scut.pinterest.mina.codec.filte;

import org.apache.mina.filter.codec.demux.DemuxingProtocolCodecFactory;
import org.se.scut.pinterest.mina.codec.filte.coder.decoder.AllPictureTypeMessageDecoder;
import org.se.scut.pinterest.mina.codec.filte.coder.decoder.AllPictureTypeResultMessageDecoder;
import org.se.scut.pinterest.mina.codec.filte.coder.decoder.PictureUploadMessageDecoder;
import org.se.scut.pinterest.mina.codec.filte.coder.decoder.PicturesGetDecoder;
import org.se.scut.pinterest.mina.codec.filte.coder.decoder.PicturesPostDecoder;
import org.se.scut.pinterest.mina.codec.filte.coder.encoder.AllPictureTypeMessageEncoder;
import org.se.scut.pinterest.mina.codec.filte.coder.encoder.AllPictureTypeResultMessageEncoder;
import org.se.scut.pinterest.mina.codec.filte.coder.encoder.PictureUploadMessageEncoder;
import org.se.scut.pinterest.mina.codec.filte.coder.encoder.PicturesGetEncoder;
import org.se.scut.pinterest.mina.codec.filte.coder.encoder.PicturesPostEncoder;
import org.se.scut.pinterest.mina.codec.msg.AllPictureTypeMessage;
import org.se.scut.pinterest.mina.codec.msg.AllPictureTypeResultMessage;
import org.se.scut.pinterest.mina.codec.msg.PictureUploadMessage;
import org.se.scut.pinterest.mina.codec.msg.PicturesGetMessage;
import org.se.scut.pinterest.mina.codec.msg.PicturesPostMessage;

public class PictureUploadCodecFactory extends DemuxingProtocolCodecFactory {

	public PictureUploadCodecFactory(boolean isServer){
		if (isServer) {
			super.addMessageDecoder(PictureUploadMessageDecoder.class);
			super.addMessageDecoder(AllPictureTypeMessageDecoder.class);
			super.addMessageEncoder(AllPictureTypeResultMessage.class, 
					AllPictureTypeResultMessageEncoder.class);
			super.addMessageDecoder(PicturesGetDecoder.class);
			super.addMessageEncoder(PicturesPostMessage.class, PicturesPostEncoder.class);
		}
		else {
			super.addMessageEncoder(PictureUploadMessage.class, PictureUploadMessageEncoder.class);
			super.addMessageEncoder(AllPictureTypeMessage.class, AllPictureTypeMessageEncoder.class);
			super.addMessageDecoder(AllPictureTypeResultMessageDecoder.class);
			super.addMessageEncoder(PicturesGetMessage.class, PicturesGetEncoder.class);
			super.addMessageDecoder(PicturesPostDecoder.class);
			
		}
	}
}
